Animation along a circular path - Solution 1

HTML

1
2
3
4
5
<div class="path">
<div class="avatar">
<img src="http://lea.verou.me/book/adamcatlace.jpg" />
</div>
</div>

CSS

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* Animation along a circular path - Solution 1
*/


@keyframes spin {
to { transform: rotate(1turn); }
}

.avatar {
animation: spin 3s infinite linear;
transform-origin: 50% 150px;
}

.avatar > img {
animation: inherit;
animation-direction: reverse;
}

/* Anything below this is just styling */

.avatar {
width: 50px;
margin: 0 auto;
border-radius: 50%;
overflow: hidden;
}

.avatar > img {
display: block;
width: inherit;
}

.path {
width: 300px; height: 300px;
padding: 20px;
border-radius: 50%;
background: #fb3;
}